package paa.simulator.grafo;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

import paa.simulator.grafo.VideoPool.Video;

public class Uploads {

	private final Set<Video> uploads;
	private final Set<Integer> tags;

	public Uploads(Set<Video> uploads) {
		this.uploads = uploads;
		this.tags = buildAllTags();
	}
	
	public Set<Video> getUploads() {
		return uploads;
	}
	
	private Set<Integer> buildAllTags() {
		Set<Integer> tags = new HashSet<Integer>();
		
		Iterator<Video> iterator = uploads.iterator();
		
		while(iterator.hasNext()) {
			tags.addAll(iterator.next().getTags());
		}
		
		return tags;
	}
	
	public Set<Integer> getTags() {
		return tags;
	}
	
}
